package com.vcredit.creditcat.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.vcredit.creditcat.model.AuthCreditcard;
import com.vcredit.creditcat.persistence.base.AuthCreditcardMapper;

/**
 * 
 **/
@Service
public class AuthCreditcardService {
	@Autowired
	private AuthCreditcardMapper mapper;

	public void insert(AuthCreditcard obj) {
		mapper.insert(obj);
	}

	public void update(AuthCreditcard obj) {
		mapper.update(obj);
	}

	public List<AuthCreditcard> findAll() {
		return mapper.findAll();
	}

	private List<AuthCreditcard> find(AuthCreditcard obj) {
		return mapper.find(obj);
	}

	public AuthCreditcard findByProcessId(Long processId) {
		AuthCreditcard param = new AuthCreditcard();
		param.setProcessId(processId);
		List<AuthCreditcard> list = find(param);
		if (!list.isEmpty())
			return list.get(0);
		return null;
	}
}